﻿@using FCZLM.Core.Models
@model IEnumerable<FCZLM.Core.Models.Messages>
@{
    ViewData["Title"] = "留言列表页";
  
    Layout = null;
}
<!DOCTYPE html>

<html>
<head> 
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <link href="/layui/css/layui.css" rel="stylesheet" />
</head>
<body>
    <div>
        <div class="demoTable layui-form">
           搜索分类：
            <div class="layui-inline">
                <input class="layui-input" name="UserName" id="UserName" autocomplete="off">
            </div>
           <button class="layui-btn" data-type="reload">搜索</button>
            
           
        </div>
        <table id="demo" lay-filter="test"></table>
    </div>
   <table class="layui-hide" id="test"></table>
              
          
<script src="/layui//layui.js" ></script>
<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
 
<script>
layui.use('table', function(){
  var table = layui.table; 
  table.render({
    elem: '#test'
    ,url: '/fuser/index'
    , page: true//开启分页
    , method: "post"
     , height: 312
    //全局定义常规单元格的最小宽度，layui 2.2.1 新增
    ,cols: [[
        { field: 'id', title: 'ID', width: 50, sort: true, fixed: 'left' }
                    , { field: 'userName', title: '用户名称', width: 200 }
                    , {
                        field: 'UserPwd', title: '用户密码', width: 150, templet:
                            "<div><input style='border:none;background:transparent;width:120px' type='password' value='{{d.UserPwd}}' readonly></input></div>"
                    }
                   
                    , { field: 'userTime', title: '注册时间', width: 200 }
                  
                ]],
                initSort: {
                    field: 'id'
                    , type: 'desc'
                },
                id: "newsList"
  });
            var $ = layui.$, active = {
                reload: function () {
                    var titleinput = $("#UserName");
                 
                    //执行重载
                    table.reload('newsList', {
                        page: {
                            curr: 1 //重新从第 1 页开始
                        }
                        , where: {
                            UserName: titleinput.val(),
                           
                        }
                    });
                }
            };
            $('.demoTable .layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
});
</script>
</body>
</html>